package cn.edu.nchu.comic_strip;

import android.os.Bundle;
import android.util.Log;

import com.google.android.material.bottomnavigation.BottomNavigationView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;

import java.util.ArrayList;
import java.util.List;

import cn.edu.nchu.comic_strip.database.dao.BookDao;
import cn.edu.nchu.comic_strip.databinding.ActivityMainBinding;
import cn.edu.nchu.comic_strip.entity.Book;
import cn.edu.nchu.comic_strip.entity.Page;

public class MainActivity extends AppCompatActivity {
    private ActivityMainBinding binding;
    private BookDao bookDao = App.getAppDatabase().getBookDao();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityMainBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        this.getSupportActionBar().hide();
        BottomNavigationView navView = findViewById(R.id.nav_view);
        // Passing each menu ID as a set of Ids because each
        // menu should be considered as top level destinations.
        AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(
                R.id.navigation_bookshelf, R.id.navigation_collection, R.id.navigation_bookmark)
                .build();
        NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_activity_main);
        NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
        NavigationUI.setupWithNavController(binding.navView, navController);
        Log.i("44",bookDao.getAllBooks().toString());
    }

}